<%flags>
	inherit => '../autohandler_noview'
</%flags>

<%args>
	$title => undef
	$doctext => undef
	$subcat_id => undef;
</%args>

<%init>
	my $error => undef;
	my $new_id = $m->comp('../dao/article_dao.mi:create', fields => { title => $title, doctext => $doctext, author => $session{'user_id'}, subcat_id => $subcat_id });
	if(defined $new_id) {
		$m->redirect('show.mc/' . $new_id);
	} else {
		$error = 1;
	}
</%init>

% if (defined $error) {
	<p>an error occured</p>
% }